Repository navigation
ci: merge-gate 判四门(只读报告),拆成 core / 夹具 / CLI 三个文件 - #3402
Conversation
…iour change
The single file was 14,317 B, and a write through the connector fails above
about 7 KB (measured: 6,792 B ok, 14,317 B `{"error":"invalid"}`), so the branch
could not be created at all. Split along the seam that was already there:
merge-gate-core.mjs 6743 B constants, latestByName, evidence, evaluate, render
merge-gate-self-test.mjs 3005 B SELF_TEST_CASES and selfTest()
merge-gate.mjs 5424 B the four-gate header, REST reader, CLI
merge-gate.mjs re-exports both other modules, so merge-gate.test.mjs is byte for
byte unchanged and still imports everything from ./merge-gate.mjs. Behaviour was
checked by differential run, not by reading: the old module from 3d0e5072 and the
new core, 93,312 synthetic fixtures over every branch of the four gates, zero
differences in evaluate() and render().
Refs #3401
QA 证据(exact head)Head (QA Engineer 出证,无写权,由 Lead 代为落库。正文按 payload 上限压缩,内容未增删实质。) 1. 绑定:我核的字节就是这个 head本地
测试文件一字节没动: 2. 本地结果(本机,不是 CI)
3. CI 结果(
|
Lead 评审记录Head 我自己核的(不是转述作者或 QA)
结论
不构成验收通过本记录只说明「这个 head 的评审意见」,不构成产品验收,也不声称与 0.3.0 parity。合并后若 rebase 或补提交,本记录与 QA 证据同时作废。 |
|
Lead 合并决定(绑定 head
|
Related #3401
这个切片做什么
新增一个只读、人跑的合并前置检查脚本
.github/scripts/merge-gate.mjs,把「一个 PR 现在能不能合」判成四道门,并给出逐门理由;配套.github/scripts/merge-gate.test.mjs。它不新增 workflow、不产生新的 check 名、不改
tests.yml,因此对FlyBot required checks没有任何影响。为什么是三个文件
原方案是单个 14,317 B 的
merge-gate.mjs,经 connector 写分支时被拒(实测上限约 7 KB:6,792 B 成功、14,317 B 返回{"error":"invalid"}),分支根本建不出来。于是沿本来就存在的缝拆开,纯求值 / 夹具 / I/O 三层分开:merge-gate-core.mjsROLLUP_CHECK、REQUIRED_CHECKS(15)、两个标记字面量、RISK_LABEL、latestByName、evidence、evaluate、render;无网络、无process.argvmerge-gate-self-test.mjsSELF_TEST_CASES五例与selfTest()merge-gate.mjsexport * from './merge-gate-core.mjs'+export { SELF_TEST_CASES }merge-gate.test.mjs(7,075 B)一个字节没改,仍从./merge-gate.mjs导入全部符号 —— 入口的再导出就是为这个。四道门
open、非 draft、mergeable已算出且为真、base 是main、head 是 40 位 SHAGET /pulls/{n}FlyBot required checks,在这个 head 上全部completed/success;同名多次取最新一次(重跑不能藏在旧绿后面)GET /commits/{sha}/check-runs?filter=latest本证据不构成验收通过,至少一条同时含 head 与Lead 评审记录GET /issues/{n}/commentsrisk:T0..T3标签,打印 tier 与「合并由 Lead 决定」;tier 不拦合并门 2 的名单是常量而不是解析
tests.yml:读 workflow 的门在 workflow 丢 job 时会安静通过,正是它要防的那种失败。门 3 只用内容匹配,不读
comment.user.login—— 它拦的是「证据缺失或绑了旧 head」,不代表「QA 亲自验证过这个 head」。作者身份绑定是另一个切片。门 4 有两个方向:tier 只是信息(T3 也 pass,
risk-approved:t3常量与分支整段删除,不是留着不触发);无标签或双标签仍 fail,因为那说的是记录,不是判级。远端 head 与本地 head 的关系
远端 head
b5c682ed78f941e439c9ca56c97564c2147af9e8(父34a80ca5a1acf9d7da821664002fa1e9dba2b215= main,tree664bdd48097d6f6f4d4b0dbafeb27cf846a28e5e)。本地开发 head 是
4a1f4722(stacked 在旧单片提交3d0e5072之上),它的 tree 也是664bdd48…—— 同一棵树,即四个文件的字节完全一致;父不同所以 commit sha 不同。四个 blob 逐个核过:coref4e0542c、self-testabfbc10d、入口a30022f2、测试2377e506,与本地git hash-object输出相同。自检(本地,绑定本地 head
4a1f4722)反例不是装饰:缺汇总门、证据绑旧 head、双 risk 标签三例都会 exit 1,所以这个脚本没有「永远绿」的路径。
拆分不改行为,这一点不是靠读出来的:把
3d0e5072的旧模块与新 core 同时 import,四门全分支组合夹具跑 93,312 例,evaluate()/render()差异 0。node --test并不在 CI 里跑(tests.yml只跑tests/*.test.mjs),上面两段都是本地绿,与 CI 绿无关。不在这个切片里
risk-gate.mjs或risk-rules.json合并前需要
FlyBot required checks全绿(绑b5c682ed);QA 按b5c682ed出证;Lead 评审意见落在本 PR 评论里;risk:T*由脚本按 diff 打出。